package com.example.demo.factory.factory01;

import java.io.*;

/**
 * @Description
 * @Author youxin
 * @Version V1.0.0
 * @Since 1.0
 * @Date 2021/12/23
 */
public class PizzaStore {
    PizzaStore(){
        //制作pizza
        Pizza pizza;
        String orderType;
        do{
            orderType=getOrderType();
            if(orderType.equals("chinese")){
                pizza=new ChinesePizza();
                pizza.getPre();
            }else if(orderType.equals("japan")){
                pizza=new JappanPizza();
                pizza.getPre();
            }else {
                break;
            }
            pizza.cookie();
            pizza.cut();
            pizza.box();
        }while (true);
    }
    private String  getOrderType(){
        try {
            BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
            System.out.println("input pizza type:");
            String str=bf.readLine();
            return str;
        }catch (IOException ioException){
            ioException.printStackTrace();
            return "";
        }
    }
}
